# !usr/bin/env python
# -*- coding:utf-8 _*-
"""
@Author:张广勤
@Web site: https://www.tunan.wang
@Github:www.github.com
 
@File:mybro04.py
@Time:2022/3/1 10:15

@Motto:不积跬步无以至千里，不积小流无以成江海！
"""
from mybro03 import Mybro



bro=Mybro()
bro.switchquery()
# with open('zdmulu.csv','r',encoding='u8') as f:
#     zdmulu=f.read()
#     zddict=eval(zdmulu)
# zd="企业一套表统计调查制度(2022)"
# # zd=zddict['23']
# print(zd)
# zdcode=find_key(zddict,zd)
# print(zdcode)
zd="企业一套表统计调查制度(2021)"
bro.getchaxunmulu(zd)
# zqlist=bro.getyjnopts(zd)
# print(zqlist)
# with open(fr"chaxunmulu\{zd}.csv",'w',encoding='u8') as f:
#     #f.write(zd)
#     f.write('')
# i=1
# with open(fr"chaxunmulu\{zd}.csv",'a', encoding='u8') as f:
#     f.write('{')
#     for zq in zqlist:
#         j=1
#         bblist,bbhb=bro.getbblist1(zd,zq)
#         #print(bblist)
#         print(bbhb)
#         for bb in bbhb:
#             k=1
#             bb,cxmllist=bro.getquery1(bb)
#             # with open('mulu.csv', 'a', encoding='u8') as f:
#             #     f.write('{')
#             #print(f'制度：{zd},周期：{zq},报表：{bb},查询目录：{cxml}')
#             for cxml in cxmllist:
#                 if j < 10:
#                     if k < 10:
#                         f.write(f"'0':'{zd}','{i}':'{zq}','{i}0{j}':{bb},'{i}0{j}0{k}':'{cxml}'")
#                         f.write(',\n')
#                     else:
#                         f.write(f"'0':'{zd}','{i}':'{zq}','{i}0{j}':{bb},'{i}0{j}{k}':'{cxml}'")
#                         f.write(',\n')
#                 else:
#                     if k < 10:
#                         f.write(f"'0':'{zd}','{i}':'{zq}','{i}0{j}':{bb},'{i}0{j}0{k}':'{cxml}'")
#                         f.write(',\n')
#                     else:
#                         f.write(f"'0':'{zd}','{i}':'{zq}','{i}0{j}':{bb},'{i}0{j}{k}':'{cxml}'")
#                         f.write(',\n')
#                 k+=1
#             j+=1
#         i+=1
#     f.write('}')
# bro.closewindow()